package com.software_product_construction.backend_software_product_construction.service.impl;

import com.software_product_construction.backend_software_product_construction.dao.RespondentMapper;
import com.software_product_construction.backend_software_product_construction.dao.example.RespondentExample;
import com.software_product_construction.backend_software_product_construction.pojo.Respondent;
import com.software_product_construction.backend_software_product_construction.service.RespondentService;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RespondentServiceImpl implements RespondentService {

    @Autowired
    RespondentMapper respondentMapper;

    @Override
    public List<Respondent> findAll(String account,String user_id,int from,int to) {
        to = to-from;
        from = from - 1;
        System.out.println(account);
        System.out.println(from);
        System.out.println(to);
        return respondentMapper.selectFromTo(account,user_id,from,to);

    }

    @Override
    public String deleteById(String id) {
        int result = respondentMapper.deleteByPrimaryKey(id);
        System.out.println("result："+result);
        if(result == 1){
            return "success";
        }
        return "false";
    }
}
